<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="pg" uri="http://jsptags.com/tags/navigation/pager" %>
<%--
  Created by IntelliJ IDEA.
  User: ACER
  Date: 2017/6/8
  Time: 20:01
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>

<html>
<head>
    <title></title>
</head>
<body>
<table align="center" style="font-size: 25px" border="1px" width="70%" >
  <tr>
    <th> 学号 </th>
    <th> 密码 </th>
    <th>  姓名</th>
    <th>  性别</th>
    <th> 系别 </th>
    <th>操作</th>
  </tr>

  <c:forEach items="${studentList}" var="student">
    <tr align="center">
      <td>${student.studentNo}</td>
      <td>${student.studentPassword}</td>
      <td>${student.studentName}</td>
      <td>${student.studentSex}</td>
      <td>${student.studentDept}</td>
      <td><a onClick="delcfm()" href="${pageContext.request.contextPath}/students/delete?id=${student.studentId}">删除</a> &nbsp;<a href="${pageContext.request.contextPath}/students/update?id=${student.studentId}&&sno=${student.studentNo}&&password=${student.studentPassword}&&name=${student.studentName}&&sex=${student.studentSex}&&dept=${student.studentDept}">更新</a></td>
    </tr>

  </c:forEach>
  <tr align="center" >
    <td colspan="5" align="center">
      <pg:pager  url="/students/search" items="${pager.totalRecord}" maxIndexPages="10" maxPageItems="${pager.pageSize}" export="currentPageNumber=pageNumber"><!-- export对pageNumber的重命名 -->
      <pg:first>
        <a href="${pageUrl }&keyword=${keyword}">首页</a>
      </pg:first>
      <pg:prev>
        <a href="${pageUrl }&keyword=${keyword}">前页</a>
      </pg:prev>
      <pg:pages>
        <c:choose>
          <c:when test="${currentPageNumber eq pageNumber }">
            <font color="red">${pageNumber }</font>
          </c:when>
          <c:otherwise>
            <a href="${pageUrl }&keyword=${keyword}">${pageNumber }</a>
          </c:otherwise>
        </c:choose>
      </pg:pages>
      <pg:next>
        <a href="${pageUrl}&keyword=${keyword}">后页</a>
      </pg:next>
      <pg:last>
        <a href="${pageUrl }&keyword=${keyword}">尾页</a>
      </pg:last>
      <br/>
      当前第${pager.pageIndex}页,共${pager.totalPage}页
      </pg:pager>
    </td>
    <td><a href="/students/add">添加学生</a>
    </td>
  </tr>
</table>

</body>
</html>
